﻿

using Microsoft.Extensions.Caching.Memory;

namespace JST.TPLMS.Util.Helpers
{
    public class MemoryCacheHelper
    {
        private static readonly MemoryCache cache = new MemoryCache(new MemoryCacheOptions());

        /// <summary>
        /// 验证缓存项是否存在
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public bool IsExists(string key)
        {
            if (key == null)
                throw new ArgumentNullException(nameof(key));
            return cache.TryGetValue(key, out _);
        }

    }
}
